package vip.xiaonuo.common.pojo;

import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import lombok.Getter;
import vip.xiaonuo.common.exception.CommonException;

public interface DbEnum {
    String DB_BRANDO_ROLE_ID = "1767561572838920194";
    String DB_CONSUME_ROLE_ID = "1767561633681494017";

    String DB_BRANDO_ORG_ID = "1767945055100805122";
    String DB_CONSUME_ORG_ID = "1767944947672096769";
    String DB_BRANDO_POSITION_ID = "1767945493502042113";
    String DB_CONSUME_POSITION_ID = "1767945431518617602";
    String ESIndex = "biz_goods_box_new";

    @Getter
    enum ORDER_STATUS {
        NO_PAY("NO_PAY"),
        PAY_CLOSE("PAY_CLOSE"),
        PAY("PAY");

        private final String value;

        ORDER_STATUS(String value) {
            this.value = value;
        }

        public static void validate(String value) {
            boolean flag = NO_PAY.getValue().equals(value) || PAY.getValue().equals(value);
            if (!flag) {
                throw new CommonException("不支持的订单状态{}", value);
            }
        }
    }

    @Getter
    enum SYS_ROLE {
        BRAND("BRAND"),
        CONSUME("CONSUME");

        private final String value;

        SYS_ROLE(String value) {
            this.value = value;
        }

        public static void validate(String value) {
            boolean flag = BRAND.getValue().equals(value) || CONSUME.getValue().equals(value);
            if (!flag) {
                throw new CommonException("不支持的角色{}", value);
            }
        }
    }

    @Getter
    enum BrandStatus {
        NORMAL("NORMAL"),
        BAN("BAN");

        private final String value;

        BrandStatus(String value) {
            this.value = value;
        }

        public static void validate(String value) {
            boolean flag = NORMAL.getValue().equals(value) || BAN.getValue().equals(value);
            if (!flag) {
                throw new CommonException("不支持的品牌状态{}", value);
            }
        }
    }

    @Getter
    enum GoodsAttr {
        INTRODUCTION("INTRODUCTION"),
        STANDARDS("STANDARDS");

        private final String value;

        GoodsAttr(String value) {
            this.value = value;
        }

        public static void validate(String value) {
            boolean flag = INTRODUCTION.getValue().equals(value) || STANDARDS.getValue().equals(value);
            if (!flag) {
                throw new CommonException("不支持的商品属性分类{}", value);
            }
        }
    }

    @Getter
    enum GoodsStatus {
        NORMAL("NORMAL"),
        BAN("BAN");

        private final String value;

        GoodsStatus(String value) {
            this.value = value;
        }

        public static void validate(String value) {
            boolean flag = NORMAL.getValue().equals(value) || BAN.getValue().equals(value);
            if (!flag) {
                throw new CommonException("不支持的商品状态{}", value);
            }
        }
    }

    @Getter
    enum Sex {
        Men("男"),
        WoMen("女");

        private final String value;

        Sex(String value) {
            this.value = value;
        }

        public static void validate(String value) {
            boolean flag = Men.getValue().equals(value) || WoMen.getValue().equals(value);
            if (!flag) {
                throw new CommonException("不支持的性别{}", value);
            }
        }
    }


    @Getter
    enum YOrN {
        YES("YES"),
        NO("NO");
        private final String value;

        YOrN(String value) {
            this.value = value;
        }

        public static void validate(String value) {
            boolean flag = YES.getValue().equals(value) || NO.getValue().equals(value);
            if (!flag) {
                throw new CommonException("不支持的状态：{}", value);
            }
        }
    }

}
